package com.zhf.entity;

/**
 * @Author: ZhaoHuanfeng
 * @Date: 2020/9/27 15:01
 */

import java.util.ArrayList;
import java.util.List;

/**
 * 对应订单表
 *  CREATE TABLE `orders` (
 *   `oid` varchar(32) NOT NULL,
 *   `ordertime` datetime DEFAULT NULL,
 *   `total` double DEFAULT NULL,
 *   `name` varchar(20) DEFAULT NULL,
 *   `telephone` varchar(20) DEFAULT NULL,
 *   `address` varchar(30) DEFAULT NULL,
 *   `state` int(11) DEFAULT NULL,
 *   `uid` varchar(32) DEFAULT NULL,
 *   PRIMARY KEY (`oid`),
 *   KEY `ofk_0001` (`uid`),
 *   CONSTRAINT `ofk_0001` FOREIGN KEY (`uid`) REFERENCES `user` (`uid`)
 * ) ENGINE=InnoDB DEFAULT CHARSET=utf8
 */
public class Orders {

    private String oid;

    //下单时间
    private String ordertime;

    //订单总金额
    private double total;

    //收货人姓名
    private String name;

    //收货人电话
    private String telephone;

    //收货人地址
    private String address;

    //订单状态，1代表已支付，0代表未支付
    private String state;

    //外键 uid
    private String uid;

    //订单对应的用户信息
    private User user;

    //描述多对一关系，一个订单中包含了多个订单项的信息
    List<OrderItem> list=new ArrayList<>();

    public String getOid() {
        return oid;
    }

    public void setOid(String oid) {
        this.oid = oid;
    }

    public String getOrdertime() {
        return ordertime;
    }

    public void setOrdertime(String ordertime) {
        this.ordertime = ordertime;
    }

    public double getTotal() {
        return total;
    }

    public void setTotal(double total) {
        this.total = total;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Override
    public String toString() {
        return "Orders{" +
                "oid='" + oid + '\'' +
                ", ordertime='" + ordertime + '\'' +
                ", total=" + total +
                ", name='" + name + '\'' +
                ", telephone='" + telephone + '\'' +
                ", address='" + address + '\'' +
                ", state='" + state + '\'' +
                ", uid='" + uid + '\'' +
                '}';
    }
}
